package com.shenzhen.group.common.card.operation;

import com.shenzhen.group.common.card.Card;
import com.shenzhen.group.common.entity.CardGroupBase;
import com.shenzhen.group.common.entity.HandCardGroupBase;
import com.shenzhen.group.common.game.Position;

import java.util.List;
import java.util.Random;
import java.util.Set;

/**
 * 操作接口
 * @author 周赛波
 * @version v1.0.0
 * @date 2021/9/19 18:30
 */
public interface CardOperation {

    int WASH_COUNT = 100;
    /**
     * 洗牌 - 默认规则
     * @param cardGroupBase 牌组
     * @author 周赛波
     * @date 2021/9/19 18:35
     */
   default void washCard(CardGroupBase cardGroupBase){
       Random random = new Random();
       List<Card> cards = cardGroupBase.getCards();
       int len = cards.size();
       for (int i = 0; i < WASH_COUNT; i++) {
           int position = random.nextInt(len);
           Card card = cards.get(0);
           Card posCard = cards.get(position);
           cards.set(position, card);
           cards.set(0, posCard);
       }
   }

    /**
     * 发牌
     * @param cardGroup 牌组
     * @param positions 玩家集合
     * @return com.shenzhen.group.common.entity.HandCardGroupBase
     * @author 周赛波
     * @date 2021/9/20 12:07
     */
    void dealCards(CardGroupBase cardGroup, List<Position> positions);



}
